import { takeEvery, put } from 'redux-saga/effects'
import axios from 'axios'
import { userLoginSync } from './actionCreator'

function* userLogin(action) {
    const result = yield axios.get(
        '/api/login?num='+action.num+'&?pass='+action.pass
        )
    if(result.data[0]){
        yield put(userLoginSync(result.data[0]))
    }
}

function* LoginSaga() {
    yield takeEvery('userLoginSaga', userLogin)
}

export default LoginSaga 